/*
 * PointResource.h
 *
 *  Created on: 2013. 9. 26.
 *      Author: mega@gamevil.com
 */

#ifndef POINTRESOURCE_H_
#define POINTRESOURCE_H_

#include <map>

namespace ProjectZ { namespace NResource {

class PointData
{
public:
	struct Flyweight
	{
		int _MIN_LEVEL;
		int _MAX_LEVEL;

		// PVP 승점
		int _WIN_LOW_WP;
		int _WIN_SAME_WP;
		int _WIN_HIGH_WP;
		int _WIN_BEST_WP;
		int _LOSE_LOW_WP;
		int _LOSE_SAME_WP;
		int _LOSE_HIGH_WP;
		int _LOSE_BEST_WP;

		// PVP 진화포인트
		int _WIN_LOW_EP;
		int _WIN_SAME_EP;
		int _WIN_HIGH_EP;
		int _WIN_BEST_EP;
		int _LOSE_LOW_EP;
		int _LOSE_SAME_EP;
		int _LOSE_HIGH_EP;
		int _LOSE_BEST_EP;

		// 배틀로얄 순위별 진화포인트
		int _PK_FIRST_EP;
		int _PK_SECOND_EP;
		int _PK_THIRD_EP;
		int _PK_FORTH_EP;
	};

public:
	PointData() {}
	virtual ~PointData();

	bool LoadResource(int compnay, int saleCode);
	Flyweight * GetFly(int level);

private:
	void	Clear();

private:
	typedef std::map<int, Flyweight *> DATATREE;
	DATATREE clsFlyTree;
};

class PointResource
{
public:
	PointResource();
	virtual ~PointResource();

	bool LoadResource();
	PointData::Flyweight * GetFly(int company, int saleCode, int level);

	int PVPWinPoint(User * pUser, User * pOppUser, bool bWin=false);
	int PVPEvolvePoint(User * pUser, User * pOppUser, bool bWin=false);
	int PKEvolvePoint(User * pUser, int myRank);

private:
	PointData * pPointAD;
	PointData * pPointIOS;
};

} /* NResource */ } /* ProjectZ */


#endif /* POINTRESOURCE_H_ */
